import request from "@/utils/request";
import {IParty, IPartyConfig, IPartyName, IRankAdjust} from "@/iwb/IParty";

/**
 * 党建配置查询
 */
export function getPartyConfig() {
    return request({
        url: '/wb/party/config',
        method: 'get',
    })
}

/**
 * 新增党建配置
 * @param data
 */
export function addPartyConfig(data: IPartyConfig) {
    return request({
        url: '/wb/party/config',
        method: 'post',
        data: data
    })
}

/**
 * 编辑部门信息
 * @param data
 */
export function editPartyConfig(data: IPartyConfig) {
    return request({
        url: '/wb/party/config',
        method: 'put',
        data: data
    })
}

/**
 * 删除党建配置
 * @param id
 */
export function deletePartyConfig(id: number) {
    return request({
        url: '/wb/party/config',
        method: 'delete',
        params: {id: id}
    })
}

/**
 * 获取党建信息
 * @param pageIndex
 * @param pageSize
 */
export function getPartyBuilding(pageIndex: number, pageSize: number) {
    return request({
        url: '/wb/party/info',
        method: 'get',
        params: {pageIndex, pageSize}
    })
}

/**
 * 获取年度党建信息
 * @param year
 */
export function getYearPartyBuilding(year: string) {
    return request({
        url: '/wb/party/info/'+year,
        method: 'get',
    })
}

/**
 * 新增党建信息
 * @param data
 */
export function addPartyBuilding(data: IParty) {
    return request({
        url: '/wb/party/info',
        method: 'post',
        data
    })
}

/**
 * 更新党建信息
 * @param data
 */
export function updatePartyBuilding(data: any) {
    return request({
        url: '/wb/party/info',
        method: 'put',
        data
    })
}

/**
 * 删除党建信息
 * @param partyName
 * @param partyTime
 */
export function deletePartyBuilding(partyName: string, partyTime: string) {
    return request({
        url: '/wb/party/info',
        method: 'delete',
        params: {partyName, partyTime}
    })
}

/**
 * 获取等次配置信息
 */
export function getRankAdjust(pageIndex: number, pageSize: number) {
    return request({
        url: '/wb/party/rank',
        method: 'get',
        params: {pageIndex, pageSize}
    })
}

/**
 * 添加等次配置信息
 */
export function addRankAdjust(data: IRankAdjust) {
    return request({
        url: '/wb/party/rank',
        method: 'post',
        data
    })
}

/**
 * 更新等次配置信息
 */
export function updateRankAdjust(data: IRankAdjust) {
    return request({
        url: '/wb/party/rank',
        method: 'put',
        data
    })
}

/**
 * 删除等次配置信息
 */
export function deleteRankAdjust(id: number) {
    return request({
        url: '/wb/party/rank',
        method: 'delete',
        params: {id}
    })
}

/**
 * 获取党组织名称信息
 */
export function getPartyName(pageIndex: number, pageSize: number) {
    return request({
        url: '/wb/party/name',
        method: 'get',
        params: {pageIndex, pageSize}
    })
}

/**
 * 添加党组织名称信息
 */
export function addPartyName(data: IPartyName) {
    return request({
        url: '/wb/party/name',
        method: 'post',
        data
    })
}

/**
 * 更新党组织名称信息
 */
export function updatePartyName(data: IPartyName) {
    return request({
        url: '/wb/party/name',
        method: 'put',
        data
    })
}

/**
 * 删除党组织名称信息
 */
export function deletePartyName(id: number) {
    return request({
        url: '/wb/party/name',
        method: 'delete',
        params: {id}
    })
}